package daybook.io.args;

import com.beust.jcommander.IParameterValidator;
import com.beust.jcommander.ParameterException;
import daybook.io.formatter.Format;

public class FormatValidator implements IParameterValidator {

    @Override
    public void validate(String name, String value) throws ParameterException {
        try {
            Format.valueOf(value.toUpperCase());
        } catch (IllegalArgumentException e) {
            throw new ParameterException("not supported format: " + value);
        }
    }
}
